<?php @session_start(); 
include "../dbconnect.php";
$name = (isset($_POST['name']))?$_POST['name']:"";
$student_code = (isset($_SESSION['student_code']))?$_SESSION['student_code']:0;
//$student_id = $_SESSION['student_id'];

if($student_code > 0 && $name != "")
{
	//update
	$sql = "UPDATE student SET confirm = '1',name = '".$name."' WHERE student_code =".$student_code;
	$update = mysql_query($sql, $link);
	if(!$update)
	{
		echo 0;
	}
	else 
	{
		//set new session name
		$_SESSION['student_name'] = $name;
		echo 1;
	}
}	
else
{
	echo 0;
}

?>